package com.training.java.module2;

import java.util.Scanner;


public class UserActionFactory {

    private History history;

    public UserActionFactory(){
        history = new History();
    }
    public void determinateAction(){
        Scanner inputScanner = new Scanner( System.in );

        System.out.println("Enter action");

        String action = inputScanner.next();
        if(action.equals("ask")){
            history.addUserAction(AskQuestion.getInstance());
        }
        if(action.equals("save")){
            history.addUserAction(new Saver());
        }
        if(action.equals("exit")){
            history.addUserAction(new CloseTest());
        }
//        throw new RuntimeException(String.format("Incorrect type of action : %c",action));
    }
    public void getUserAction(){
        history.getUserAction();
    }
}
